package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.mapper.AlertDataMapper;
import com.zzyl.mapper.AlertRuleMapper;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import com.zzyl.vo.AlertRuleVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/alert-data")
@Api(tags = "管理端 - 报警信息相关接口")
public class AlertDataController {

    @Autowired
    private AlertDataService alertDataService;

    @GetMapping("/pageQuery")
    @ApiOperation(value = "分页获取告警规则列表", notes = "接收一个Pageable参数作为请求参数，返回一个包含分页数据的Page<AlertRuleDto>")
    public ResponseResult<PageResponse<AlertDataVo>> getAlertRulePage(@ApiParam(value = "页码", required = true) @RequestParam("pageNum") Integer pageNum,
                                                                         @ApiParam(value = "每页大小", required = true) @RequestParam("pageSize") Integer pageSize,
                                                                         @ApiParam(value = "设备名称，精确查询") @RequestParam(value = "deviceName", required = false) String deviceName,
                                                                         @RequestParam(value = "endTime", required = false) Integer endTime,
                                                                         @RequestParam(value = "id", required = false) Integer id,
                                                                         @RequestParam(value = "startTime", required = false) Integer startTime,
                                                                         @RequestParam(value = "status", required = false) Integer status)
    {
        return ResponseResult.success(alertDataService.page(pageNum,pageSize,deviceName,endTime,id,startTime,status));
    }


}
